/*
 * @Author: xiaosihan 
 * @Date: 2024-06-11 17:52:07 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2024-06-11 18:07:16
 */
import { autorun } from "mobx";
import { ReactNode, useEffect, useRef, useState } from "react";
import styles from "./btns.module.less";
import { Button } from "antd";
import homeStore from "@views/home/homeStore";

interface Iprops {
    children?: ReactNode
}

export default function Btn() {

    const dom = useRef<HTMLDivElement | null>(null);
    const [showRoom, setShowRoom] = useState(homeStore.showRoom);
    const [showTV, setShowTV] = useState(homeStore.showTV);

    useEffect(() => {

    }, []);

    useEffect(() => autorun(() => {
        setShowRoom(homeStore.showRoom);
        setShowTV(homeStore.showTV);
    }), []);

    return (
        <div className={styles.btns} >
            <Button.Group>
                <Button
                    type={showRoom ? "primary" : undefined}
                    onClick={() => homeStore.setShowRoom(!showRoom)}
                >显示房间</Button>
                <Button
                    type={showTV ? "primary" : undefined}
                    onClick={() => homeStore.setShowTV(!showTV)}
                >显示屏幕</Button>
            </Button.Group>
        </div>
    );

}